import axiosHttp from "../index";
import type {
  UserFormParams,
  ResetPasswordParams,
  EditPasswordParams,
} from "./type";

export const getUserList = () => {
  return axiosHttp.get("/api/user/list");
};

export const getInfo = () => {
  return axiosHttp.get("/api/user/info");
};

export const createUser = (data: UserFormParams) => {
  return axiosHttp.post("/api/user/create", data);
};

export const editUser = (id: number, data: UserFormParams) => {
  return axiosHttp.put(`/api/user/update/${id}`, data);
};

export const deleteUser = (id: number) => {
  return axiosHttp.delete(`/api/user/delete/${id}`);
};

export const resetPassword = (data: ResetPasswordParams) => {
  return axiosHttp.put("/api/user/reset-password", data);
};

export const editPassword = (data: EditPasswordParams) => {
  return axiosHttp.put("/api/user/update-password", data);
};
